﻿<cfscript>
/** 
* ORM FormClassBook
* 
* @hint "Hibernate persistenter t_class_book. 班级教材征订计划" 
* 
*/ 

component 
	displayname="public.service.orm.senate.FormClassBook" 
	output=false 
	persistent=true 
	selectBeforeUpdate=true dynamicInsert=true dynamicUpdate=true 
	cacheuse="Transactional" 
	entityname="FormClassBook" 
	table="t_class_book"
	{

	property type="string" name="PlanID" column="ccbid" fieldtype="id" generator="assigned" hint="班级教材征订计划号";

	property type="numeric" name="Plan" column="book_plan" hint="教材征订数量";
	property type="numeric" name="Sell" column="book_out" hint="教材实发数量";
	property type="string" name="BillCreateTime" column="opertime" hint="出单时间";

	property name="FormClass" fieldtype="many-to-one" fkcolumn="cls_id" cfc="FormClass" hint="班级";
	property name="CourseBook" fieldtype="many-to-one" fkcolumn="cbid" cfc="CourseBook"  hint="教材征订计划";
	
	/**
	* @hint "自定义主键规则"
	* 
	* @FormClass 班级
	* @CourseBook 教材征订计划
	*/
	public string function getID( required FormClass, required CourseBook ) output=false {
		
		var nextID = arguments.FormClass.getClassID() & "," & arguments.CourseBook.getCourseBookID();

		/* 
			主键生成规则 
			
			班级教材征订计划号23位 10位班级代码 , 12位教材选用编号

			Unique: CLS_ID, CBID
		*/
		return nextID;
	}
	
}

</cfscript>